﻿using System;
using System.IO;
using System.Windows.Forms;
using System.Xml.Linq;
using Styx;
using Styx.Common;

namespace TuanHA_Combat_Routine
{
    public partial class THForm : Form
    {
        public THForm()
        {
            InitializeComponent();
        }

        private static int TalentValue(int holy, int protection, int retribution)
        {
            return Classname.GetCurrentSpec() == "Holy"
                       ? holy
                       : (Classname.GetCurrentSpec() == "Protection" ? protection : retribution);
        }

        public bool TalentValue(bool holy, bool protection, bool retribution)
        {
            return Classname.GetCurrentSpec() == "Holy"
                       ? holy
                       : (Classname.GetCurrentSpec() == "Protection" ? protection : retribution);
        }

        private void THForm_Load(object sender, EventArgs e)
        {
            #region TabPages.Remove

            if (!StyxWoW.Me.Name.Contains("Dust") && Classname.GetCurrentSpec() == "Protection")
            {
                tabControl1.TabPages.Remove(tabPage3);
                tabControl1.TabPages.Remove(tabPage5);
            }
            else if (!StyxWoW.Me.Name.Contains("Dust") && Classname.GetCurrentSpec() == "Holy")
            {
                tabControl1.TabPages.Remove(tabPage4);
                tabControl1.TabPages.Remove(tabPage5);
            }
            else if (!StyxWoW.Me.Name.Contains("Dust"))
            {
                tabControl1.TabPages.Remove(tabPage3);
                tabControl1.TabPages.Remove(tabPage4);
            }

            #endregion

            #region Load Files

            if (
                File.Exists(Utilities.AssemblyDirectory +
                            @"\Routines\TuanHAPaladinSpecialEdition\TuanHA-Paladin-Picture.jpg"))
            {
                pictureBox1.ImageLocation = Utilities.AssemblyDirectory +
                                            @"\Routines\TuanHAPaladinSpecialEdition\TuanHA-Paladin-Picture.jpg";
            }

            if (File.Exists(Utilities.AssemblyDirectory +
                            @"\Routines\TuanHAPaladinSpecialEdition\SpecialThanks.rtf"))
            {
                richTextBox1.LoadFile(Utilities.AssemblyDirectory +
                                      @"\Routines\TuanHAPaladinSpecialEdition\SpecialThanks.rtf");
            }

            #endregion

            #region Load General

            ArdentDefender.Checked = THSettings.Instance.ArdentDefender;
            ArdentDefenderHP.Value = THSettings.Instance.ArdentDefenderHP;
            AvengersShieldLoseThreat.Checked = THSettings.Instance.AvengersShieldLowestThreat;
            AutoBuff.Checked = THSettings.Instance.AutoBuff;
            AutoCancelBubble.Checked = THSettings.Instance.AutoCancelBubble;
            AutoCancelBubbleHP.Value = THSettings.Instance.AutoCancelBubbleHP;
            AutoUseFood.Checked = THSettings.Instance.AutoUseFood;
            AutoUseFoodHP.Value = THSettings.Instance.AutoUseFoodHP;
            AutoFace.Checked = THSettings.Instance.AutoFace;
            AutoMove.Checked = THSettings.Instance.AutoMove;
            AutoRacial.Checked = THSettings.Instance.AutoRacial;
            AutoRez.Checked = THSettings.Instance.AutoRez;
            AutoRighteousFury.Checked = THSettings.Instance.AutoRighteousFury;
            AutoTarget.Checked = THSettings.Instance.AutoTarget;
            AutoTaunt.Checked = THSettings.Instance.AutoTaunt;
            AvengingWrathHoly.Checked = THSettings.Instance.AvengingWrathHoly;
            AvengingWrathHolyNumber.Value = THSettings.Instance.AvengingWrathHolyNumber;
            AvengingWrathHolyHP.Value = THSettings.Instance.AvengingWrathHolyHP;
            Backward.SelectedIndex = THSettings.Instance.Backward;
            BattleStandard.Checked = THSettings.Instance.BattleStandard;
            BattleStandardHP.Value = THSettings.Instance.BattleStandardHP;
            BeaconofLight.Checked = THSettings.Instance.BeaconofLight;
            BlindingLightInterrupt.Checked = THSettings.Instance.BlindingLightInterrupt;
            BlindingLightInterruptMs.Value = THSettings.Instance.BlindingLightInterruptMs;
            BlindingLightLow.Checked = THSettings.Instance.BlindingLightLow;
            BlindingLightLowHP.Value = THSettings.Instance.BlindingLightLowHP;
            BurstHP.Value = THSettings.Instance.BurstHP;
            BurstKey.SelectedIndex = THSettings.Instance.BurstKey;
            BurstDelay.Value = THSettings.Instance.BurstDelay;
            CleanseDebuff.Checked = THSettings.Instance.CleanseDebuff;
            CleanseASAP.Checked = THSettings.Instance.CleanseASAP;
            CleanseDebuffNumber.Value = THSettings.Instance.CleanseDebuffNumber;
            Consecration.Checked = THSettings.Instance.Consecration;
            CrusaderStrikeHoly.Checked = THSettings.Instance.CrusaderStrikeHoly;
            Denounce.Checked = THSettings.Instance.Denounce;
            DevotionAura.Checked = THSettings.Instance.DevotionAura;
            DevotionAuraHP.Value = THSettings.Instance.DevotionAuraHP;
            DevotionAuraSilence.Checked = THSettings.Instance.DevotionAuraSilence;
            DevotionAuraSilenceAny.Checked = THSettings.Instance.DevotionAuraSilenceAny;
            DevotionAuraSilenceHealer.Checked = THSettings.Instance.DevotionAuraSilenceHealer;
            DevotionAuraSilenceCaster.Checked = THSettings.Instance.DevotionAuraSilenceCaster;
            DevotionAuraSilenceHP.Value = THSettings.Instance.DevotionAuraSilenceHP;
            DivineFavor.Checked = THSettings.Instance.DivineFavor;
            DivineFavorNumber.Value = THSettings.Instance.DivineFavorNumber;
            DivineFavorHP.Value = THSettings.Instance.DivineFavorHP;
            DivineLight.Checked = THSettings.Instance.DivineLight;
            DivineLightHP.Value = THSettings.Instance.DivineLightHP;
            DivinePlea.Checked = THSettings.Instance.DivinePlea;
            DivinePleaHP.Value = THSettings.Instance.DivinePleaHP;
            DivineProtection.Checked = THSettings.Instance.DivineProtection;
            DivineProtectionHP.Value = THSettings.Instance.DivineProtectionHP;
            DivineShield.Checked = THSettings.Instance.DivineShield;
            DivineShieldHP.Value = THSettings.Instance.DivineShieldHP;
            DivineStorm.Checked = THSettings.Instance.DivineStorm;
            DivineStormUnit.Value = THSettings.Instance.DivineStormUnit;
            EternalFlameBlanket.Checked = THSettings.Instance.EternalFlameBlanket;
            EternalFlameBlanketHolyPower.Value = THSettings.Instance.EternalFlameBlanketHolyPower;
            ExecutionSentenceFriend.Checked = THSettings.Instance.ExecutionSentenceFriend;
            ExecutionSentenceFriendHP.Value = THSettings.Instance.ExecutionSentenceFriendHP;
            ExecutionSentenceEnemy.Checked = THSettings.Instance.ExecutionSentenceEnemy;
            ExecutionSentenceEnemyHP.Value = THSettings.Instance.ExecutionSentenceEnemyHP;
            FlashofLightHoly.Checked = THSettings.Instance.FlashofLightHoly;
            FlashofLightHolyHP.Value = THSettings.Instance.FlashofLightHolyHP;
            FlashofLightFriendRet.Checked = THSettings.Instance.FlashofLightFriendRet;
            FlashofLightFriendRetHP.Value = THSettings.Instance.FlashofLightFriendRetHP;
            FlashofLightMeProt.Checked = THSettings.Instance.FlashofLightMeProt;
            FlashofLightMeProtHP.Value = THSettings.Instance.FlashofLightMeProtHP;
            FlashofLightMeRet.Checked = THSettings.Instance.FlashofLightMeRet;
            FlashofLightMeRetHP.Value = THSettings.Instance.FlashofLightMeRetHP;
            Forward.SelectedIndex = THSettings.Instance.Forward;
            Group1.Checked = THSettings.Instance.Group1;
            Group2.Checked = THSettings.Instance.Group2;
            Group3.Checked = THSettings.Instance.Group3;
            Group4.Checked = THSettings.Instance.Group4;
            Group5.Checked = THSettings.Instance.Group5;
            Group6.Checked = THSettings.Instance.Group6;
            Group7.Checked = THSettings.Instance.Group7;
            Group8.Checked = THSettings.Instance.Group8;
            GuardianofAncientKingsHoly.Checked = THSettings.Instance.GuardianofAncientKingsHoly;
            GuardianofAncientKingsHolyNumber.Value = THSettings.Instance.GuardianofAncientKingsHolyNumber;
            GuardianofAncientKingsHolyHP.Value = THSettings.Instance.GuardianofAncientKingsHolyHP;
            GuardianofAncientKingsProt.Checked = THSettings.Instance.GuardianofAncientKingsProt;
            GuardianofAncientKingsProtHP.Value = THSettings.Instance.GuardianofAncientKingsProtHP;
            HammerofJusticeInterrupt.Checked = THSettings.Instance.HammerofJusticeInterrupt;
            HammerofJusticeInterruptMs.Value = THSettings.Instance.HammerofJusticeInterruptMs;
            HammerofJusticeLow.Checked = THSettings.Instance.HammerofJusticeLow;
            HammerofJusticeLowHP.Value = THSettings.Instance.HammerofJusticeLowHP;
            HammerofJusticeEnemyLow.Checked = THSettings.Instance.HammerofJusticeEnemyLow;
            HammerofJusticeEnemyLowHP.Value = THSettings.Instance.HammerofJusticeEnemyLowHP;
            HammerofJusticeEnemyUsingCD.Checked = THSettings.Instance.HammerofJusticeEnemyUsingCD;
            HammeroftheRighteousUnit.Checked = THSettings.Instance.HammeroftheRighteousRet;
            HammeroftheRighteousUnitNumber.Value = THSettings.Instance.HammeroftheRighteousRetNumber;
            HammeroftheRighteousRetWeakenedBlows.Checked = THSettings.Instance.HammeroftheRighteousRetWeakenedBlows;
            HammeroftheRighteousProt.Checked = THSettings.Instance.HammeroftheRighteousProt;
            HammeroftheRighteousProtUnit.Value = THSettings.Instance.HammeroftheRighteousProtUnit;
            HammerofWrathHoly.Checked = THSettings.Instance.HammerofWrathHoly;
            HandofFreedomCaster.Checked = THSettings.Instance.HandofFreedomCaster;
            HandofFreedomHealer.Checked = THSettings.Instance.HandofFreedomHealer;
            HandofFreedomMelee.Checked = THSettings.Instance.HandofFreedomMelee;
            HandofFreedomMyself.Checked = THSettings.Instance.HandofFreedomMyself;
            HandofProtection.Checked = THSettings.Instance.HandofProtection;
            HandofProtectionHP.Value = THSettings.Instance.HandofProtectionHP;
            HandofProtectionHPRemoveCC.Checked = THSettings.Instance.HandofProtectionHPRemoveCC;
            HandofPurity.Checked = THSettings.Instance.HandofPurity;
            HandofPurityHP.Value = THSettings.Instance.HandofPurityHP;
            HandofPurityDebuff.Checked = THSettings.Instance.HandofPurityDebuff;
            HandofPurityDebuffNumber.Value = THSettings.Instance.HandofPurityDebuffNumber;
            HandofSacrifice.Checked = THSettings.Instance.HandofSacrifice;
            HandofSacrificeHP.Value = THSettings.Instance.HandofSacrificeHP;
            HandofSacCCRemoveHealer.Checked = THSettings.Instance.HandofSacCCRemoveHealer;
            HandofSacCCRemoveCaster.Checked = THSettings.Instance.HandofSacCCRemoveCaster;
            HandofSacCCRemoveMelee.Checked = THSettings.Instance.HandofSacCCRemoveMelee;
            HandofSalvHighThreat.Checked = THSettings.Instance.HandofSalvHighThreat;
            HandofSalvHighThreatPercent.Value = THSettings.Instance.HandofSalvHighThreatPercent;
            HealBalancing.Value = THSettings.Instance.HealBalancing;
            HealthStone.Checked = THSettings.Instance.HealthStone;
            HealthStoneHP.Value = THSettings.Instance.HealthStoneHP;
            HolyAvengerHoly.Checked = THSettings.Instance.HolyAvengerHoly;
            HolyAvengerHolyNumber.Value = THSettings.Instance.HolyAvengerHolyNumber;
            HolyAvengerHolyHP.Value = THSettings.Instance.HolyAvengerHolyHP;
            HolyLight.Checked = THSettings.Instance.HolyLight;
            HolyLightHP.Value = THSettings.Instance.HolyLightHP;
            HolyPrismFriend.Checked = THSettings.Instance.HolyPrismFriend;
            HolyPrismFriendHP.Value = THSettings.Instance.HolyPrismFriendHP;
            HolyPrismEnemy.Checked = THSettings.Instance.HolyPrismEnemy;
            HolyPrismEnemyHP.Value = THSettings.Instance.HolyPrismEnemyHP;
            HolyPrismEnemyHeal.Checked = THSettings.Instance.HolyPrismEnemyHeal;
            HolyPrismEnemyHealNumber.Value = THSettings.Instance.HolyPrismEnemyHealNumber;
            HolyPrismEnemyHealHP.Value = THSettings.Instance.HolyPrismEnemyHealHP;
            HolyPrismFriendDPS.Checked = THSettings.Instance.HolyPrismFriendDPS;
            HolyPrismFriendDPSNumber.Value = THSettings.Instance.HolyPrismFriendDPSNumber;
            HolyRadiance.Checked = THSettings.Instance.HolyRadiance;
            HolyRadianceNumber.Value = THSettings.Instance.HolyRadianceNumber;
            HolyRadianceHP.Value = THSettings.Instance.HolyRadianceHP;
            HolyShockOffensive.Checked = THSettings.Instance.HolyShockOffensive;
            //Hotkey1
            Hotkey1Target.SelectedIndex = THSettings.Instance.Hotkey1Target;
            Hotkey1Mod.SelectedIndex = THSettings.Instance.Hotkey1Mod;
            Hotkey1Key.SelectedIndex = THSettings.Instance.Hotkey1Key;
            Hotkey1Spell.SelectedIndex = THSettings.Instance.Hotkey1Spell;
            //Hotkey2
            Hotkey2Target.SelectedIndex = THSettings.Instance.Hotkey2Target;
            Hotkey2Mod.SelectedIndex = THSettings.Instance.Hotkey2Mod;
            Hotkey2Key.SelectedIndex = THSettings.Instance.Hotkey2Key;
            Hotkey2Spell.SelectedIndex = THSettings.Instance.Hotkey2Spell;
            //Hotkey3
            Hotkey3Target.SelectedIndex = THSettings.Instance.Hotkey3Target;
            Hotkey3Mod.SelectedIndex = THSettings.Instance.Hotkey3Mod;
            Hotkey3Key.SelectedIndex = THSettings.Instance.Hotkey3Key;
            Hotkey3Spell.SelectedIndex = THSettings.Instance.Hotkey3Spell;
            //Hotkey4
            Hotkey4Target.SelectedIndex = THSettings.Instance.Hotkey4Target;
            Hotkey4Mod.SelectedIndex = THSettings.Instance.Hotkey4Mod;
            Hotkey4Key.SelectedIndex = THSettings.Instance.Hotkey4Key;
            Hotkey4Spell.SelectedIndex = THSettings.Instance.Hotkey4Spell;
            //Hotkey5
            Hotkey5Target.SelectedIndex = THSettings.Instance.Hotkey5Target;
            Hotkey5Mod.SelectedIndex = THSettings.Instance.Hotkey5Mod;
            Hotkey5Key.SelectedIndex = THSettings.Instance.Hotkey5Key;
            Hotkey5Spell.SelectedIndex = THSettings.Instance.Hotkey5Spell;

            InterruptAll.Checked = THSettings.Instance.InterruptAll;
            InterruptTarget.Checked = THSettings.Instance.InterruptTarget;
            InterruptFocus.Checked = THSettings.Instance.InterruptFocus;
            Inquisition.Checked = THSettings.Instance.Inquisition;
            InquisitionHolyPowerNumber.Value = THSettings.Instance.InquisitionHolyPower;
            JudgmentHolyAttack.Checked = THSettings.Instance.JudgmentHolyAttack;
            JudgmentBurdenofGuilt.Checked = THSettings.Instance.JudgmentBurdenofGuilt;
            JudgmentLongArmoftheLaw.Checked = THSettings.Instance.JudgmentLongArmoftheLaw;
            label66.Text = "" + THSettings.Instance.HealBalancing;
            LayonHands.Checked = THSettings.Instance.LayonHands;
            LayonHandsHP.Value = THSettings.Instance.LayonHandsHP;
            LightsHammerEnemy.Checked = THSettings.Instance.LightsHammerEnemy;
            LightsHammerEnemyNumber.Value = THSettings.Instance.LightsHammerEnemyNumber;
            LightsHammerFriend.Checked = THSettings.Instance.LightsHammerFriend;
            LightsHammerFriendNumber.Value = THSettings.Instance.LightsHammerFriendNumber;
            LightsHammerFriendHP.Value = THSettings.Instance.LightsHammerFriendHP;
            LightofDawn.Checked = THSettings.Instance.LightofDawn;
            LightofDawnNumber.Value = THSettings.Instance.LightofDawnNumber;
            LightofDawnHP.Value = THSettings.Instance.LightofDawnHP;
            ManaforDPS.Value = THSettings.Instance.ManaforDPS;
            OnlyHealFocus.Checked = THSettings.Instance.OnlyHealFocus;
            OnlyHealMe.Checked = THSettings.Instance.OnlyHealMe;
            OnlyHealTarget.Checked = THSettings.Instance.OnlyHealTarget;
            PauseKey.SelectedIndex = THSettings.Instance.PauseKey;
            PreferKings.Checked = THSettings.Instance.PreferKings;
            PreferMight.Checked = THSettings.Instance.PreferMight;
            ProfBuff.SelectedIndex = THSettings.Instance.ProfBuff;
            ProfBuffHP.Value = THSettings.Instance.ProfBuffHP;
            Rebuke.Checked = THSettings.Instance.Rebuke;
            RebukeMs.Value = THSettings.Instance.RebukeMs;
            RepentanceCC.Checked = THSettings.Instance.RepentanceCC;
            SacredShieldProt.Checked = THSettings.Instance.SacredShieldProt;
            SacredShieldRet.Checked = THSettings.Instance.SacredShieldRet;
            SealofRighteousnessRet.Checked = THSettings.Instance.SealofRighteousnessRet;
            SealofRighteousnessRetNumber.Value = THSettings.Instance.SealofRighteousnessRetNumber;
            SealofRighteousnessProt.Checked = THSettings.Instance.SealofRighteousnessProt;
            SealofRighteousnessProtNumber.Value = THSettings.Instance.SealofRighteousnessProtNumber;
            SelflessHealer.Checked = THSettings.Instance.SelflessHealer;
            SelflessHealerHP.Value = THSettings.Instance.SelflessHealerHP;
            ShieldofRighterous.Checked = THSettings.Instance.ShieldofRighterous;
            ShieldofRighterousHP.Value = THSettings.Instance.ShieldofRighterousHP;
            SpeedofLight.Checked = THSettings.Instance.SpeedofLight;
            SpeedofLightDistance.Value = THSettings.Instance.SpeedofLightDistance;
            StrafleLeft.SelectedIndex = THSettings.Instance.StrafleLeft;
            StrafleRight.SelectedIndex = THSettings.Instance.StrafleRight;
            Trinket1.SelectedIndex = THSettings.Instance.Trinket1;
            Trinket1HP.Value = THSettings.Instance.Trinket1HP;
            Trinket2.SelectedIndex = THSettings.Instance.Trinket2;
            Trinket2HP.Value = THSettings.Instance.Trinket2HP;
            THSettings.Instance.Pause = false;
            TurnEvil.Checked = THSettings.Instance.TurnEvil;
            TurnEvilASAP.Checked = THSettings.Instance.TurnEvilASAP;
            TurnLeft.SelectedIndex = THSettings.Instance.TurnLeft;
            TurnRight.SelectedIndex = THSettings.Instance.TurnRight;
            WordofGloryHoly.Checked = THSettings.Instance.WordofGloryHoly;
            WordofGloryHolyHP.Value = THSettings.Instance.WordofGloryHolyHP;
            WordofGloryFriendRet.Checked = THSettings.Instance.WordofGloryFriendRet;
            WordofGloryFriendRetHP.Value = THSettings.Instance.WordofGloryFriendRetHP;
            WordofGloryMeProt.Checked = THSettings.Instance.WordofGloryMeProt;
            WordofGloryMeProtHolyPower.Value = THSettings.Instance.WordofGloryMeProtHolyPower;
            WordofGloryMeProtHP.Value = THSettings.Instance.WordofGloryMeProtHP;
            WordofGloryFriendProt.Checked = THSettings.Instance.WordofGloryFriendProt;
            WordofGloryFriendProtHolyPower.Value = THSettings.Instance.WordofGloryFriendProtHolyPower;
            WordofGloryFriendProtHP.Value = THSettings.Instance.WordofGloryFriendProtHP;
            WordofGloryMeRet.Checked = THSettings.Instance.WordofGloryMeRet;
            WordofGloryMeRetHP.Value = THSettings.Instance.WordofGloryMeRetHP;

            #endregion
        }

        #region Buttons

        #region OK

        private void pictureBox1_Click(object sender, EventArgs e)
        {
            System.Diagnostics.Process.Start("http://www.tuanha.biz/");
        }

        private void BOK_Click(object sender, EventArgs e)
        {
            //MessageBox.Show("TuanHA Paladin Settings have been saved", "Save");
            THSettings.Instance.Save();
            Logging.Write("----------------------------------");
            Logging.Write("TuanHA " + Classname.GetCurrentSpec() + " Paladin Settings have been saved");

            Logging.Write(LogLevel.Diagnostic, "Your Setting for Debug Purpose Only");
            foreach (var var in THSettings.Instance.GetSettings())
            {
                Logging.Write(LogLevel.Diagnostic, var.ToString());
            }

            Close();
            THSettings.Instance.UpdateStatus = true;
        }

        #endregion

        #region Save

        private void bSave_Click(object sender, EventArgs e)
        {
            THSettings.Instance.Save();
            Logging.Write("TuanHA " + Classname.GetCurrentSpec() + " Paladin Settings have been saved");
            THSettings.Instance.UpdateStatus = true;
        }

        #endregion

        #region Dungeon

        private void BDungeon_Click(object sender, EventArgs e)
        {
            if (File.Exists(Utilities.AssemblyDirectory +
                            @"\Routines\TuanHAPaladinSpecialEdition\Preset\TuanHA " + Classname.GetCurrentSpec() +
                            " Paladin Default Dungeon.xml"))
            {
                MessageBox.Show(
                    "Dungeon Mode: Work best with Tyrael in Dungeon.",
                    "Important Note",
                    MessageBoxButtons.OK, MessageBoxIcon.Information);

                THSettings.Instance.LoadFromXML(XElement.Load(Utilities.AssemblyDirectory +
                                                              @"\Routines\TuanHAPaladinSpecialEdition\Preset\TuanHA " +
                                                              Classname.GetCurrentSpec() +
                                                              " Paladin Default Dungeon.xml"));
                Logging.Write("----------------------------------");
                Logging.Write("Load TuanHA " + Classname.GetCurrentSpec() +
                              " Paladin Default Dungeon Settings from a file complete");
                Logging.Write("----------------------------------");
                THForm_Load(null, null);
            }
            else
            {
                Logging.Write("----------------------------------");
                Logging.Write("File not exists: " + Utilities.AssemblyDirectory +
                              @"\Routines\TuanHAPaladinSpecialEdition\Preset\TuanHA " + Classname.GetCurrentSpec() +
                              " Paladin Default Dungeon.xml");
                Logging.Write("Load TuanHA " + Classname.GetCurrentSpec() +
                              " Paladin Default Dungeon Settings from a file fail.");
                Logging.Write("----------------------------------");
                THForm_Load(null, null);
            }
        }

        #endregion

        #region Raid

        private void BRaid_Click(object sender, EventArgs e)
        {
            if (File.Exists(Utilities.AssemblyDirectory +
                            @"\Routines\TuanHAPaladinSpecialEdition\Preset\TuanHA " + Classname.GetCurrentSpec() +
                            " Paladin Default Raid.xml"))
            {
                MessageBox.Show(
                    "Raid Mode: Work best with Tyrael in Raid.",
                    "Important Note",
                    MessageBoxButtons.OK, MessageBoxIcon.Information);

                THSettings.Instance.LoadFromXML(XElement.Load(Utilities.AssemblyDirectory +
                                                              @"\Routines\TuanHAPaladinSpecialEdition\Preset\TuanHA " +
                                                              Classname.GetCurrentSpec() + " Paladin Default Raid.xml"));
                Logging.Write("----------------------------------");
                Logging.Write("Load TuanHA " + Classname.GetCurrentSpec() +
                              " Paladin Default Raid Settings from a file complete");
                Logging.Write("----------------------------------");
                THForm_Load(null, null);
            }
            else
            {
                Logging.Write("----------------------------------");
                Logging.Write("File not exists: " + Utilities.AssemblyDirectory +
                              @"\Routines\TuanHAPaladinSpecialEdition\Preset\TuanHA " + Classname.GetCurrentSpec() +
                              " Paladin Default Raid.xml");
                Logging.Write("Load TuanHA " + Classname.GetCurrentSpec() +
                              " Paladin Default Raid Settings from a file fail.");
                Logging.Write("----------------------------------");
                THForm_Load(null, null);
            }
        }

        #endregion

        #region PVP

        private void BPvPHelper_Click(object sender, EventArgs e)
        {
            if (File.Exists(Utilities.AssemblyDirectory +
                            @"\Routines\TuanHAPaladinSpecialEdition\Preset\TuanHA " + Classname.GetCurrentSpec() +
                            " Paladin Default PvP.xml"))
            {
                MessageBox.Show(
                    "PvP Mode: Work best with Tyrael in PvP.",
                    "Important Note",
                    MessageBoxButtons.OK, MessageBoxIcon.Information);

                THSettings.Instance.LoadFromXML(XElement.Load(Utilities.AssemblyDirectory +
                                                              @"\Routines\TuanHAPaladinSpecialEdition\Preset\TuanHA " +
                                                              Classname.GetCurrentSpec() + " Paladin Default PvP.xml"));
                Logging.Write("----------------------------------");
                Logging.Write("Load TuanHA " + Classname.GetCurrentSpec() +
                              " Paladin Default PvP Settings from a file complete");
                Logging.Write("----------------------------------");
                THForm_Load(null, null);
            }
            else
            {
                Logging.Write("----------------------------------");
                Logging.Write("File not exists: " + Utilities.AssemblyDirectory +
                              @"\Routines\TuanHAPaladinSpecialEdition\Preset\TuanHA " + Classname.GetCurrentSpec() +
                              " Paladin Default PvP.xml");
                Logging.Write("Load TuanHA " + Classname.GetCurrentSpec() +
                              " Paladin Default PvP Settings from a file fail.");
                Logging.Write("----------------------------------");
                THForm_Load(null, null);
            }
        }

        #endregion

        #region Quest

        private void BQuestHelper_Click(object sender, EventArgs e)
        {
            if (File.Exists(Utilities.AssemblyDirectory +
                            @"\Routines\TuanHAPaladinSpecialEdition\Preset\TuanHA " + Classname.GetCurrentSpec() +
                            " Paladin Default Quest.xml"))
            {
                MessageBox.Show(
                    "Quest Mode: Work best with Tyrael in Quest.",
                    "Important Note",
                    MessageBoxButtons.OK, MessageBoxIcon.Information);

                THSettings.Instance.LoadFromXML(XElement.Load(Utilities.AssemblyDirectory +
                                                              @"\Routines\TuanHAPaladinSpecialEdition\Preset\TuanHA " +
                                                              Classname.GetCurrentSpec() + " Paladin Default Quest.xml"));
                Logging.Write("----------------------------------");
                Logging.Write("Load TuanHA " + Classname.GetCurrentSpec() +
                              " Paladin Default Quest Settings from a file complete");
                Logging.Write("----------------------------------");
                THForm_Load(null, null);
            }
            else
            {
                Logging.Write("----------------------------------");
                Logging.Write("File not exists: " + Utilities.AssemblyDirectory +
                              @"\Routines\TuanHAPaladinSpecialEdition\Preset\TuanHA " + Classname.GetCurrentSpec() +
                              " Paladin Default Quest.xml");
                Logging.Write("Load TuanHA " + Classname.GetCurrentSpec() +
                              " Paladin Default Quest Settings from a file fail.");
                Logging.Write("----------------------------------");
                THForm_Load(null, null);
            }
        }

        #endregion

        #region FullAFK

        private void BFullAfk_Click(object sender, EventArgs e)
        {
            if (File.Exists(Utilities.AssemblyDirectory +
                            @"\Routines\TuanHAPaladinSpecialEdition\Preset\TuanHA " + Classname.GetCurrentSpec() +
                            " Paladin Default AFK.xml"))
            {
                MessageBox.Show(
                    "Full AFK Mode: Work best with BGBuddy, ArcheologyBuddy, DungeonBuddy, Grind Bot, Questing...",
                    "Important Note",
                    MessageBoxButtons.OK, MessageBoxIcon.Information);

                THSettings.Instance.LoadFromXML(XElement.Load(Utilities.AssemblyDirectory +
                                                              @"\Routines\TuanHAPaladinSpecialEdition\Preset\TuanHA " +
                                                              Classname.GetCurrentSpec() + " Paladin Default AFK.xml"));
                Logging.Write("----------------------------------");
                Logging.Write("Load TuanHA " + Classname.GetCurrentSpec() +
                              " Paladin Default AFK Settings from a file complete");
                Logging.Write("----------------------------------");
                THForm_Load(null, null);
            }
            else
            {
                Logging.Write("----------------------------------");
                Logging.Write("File not exists: " + Utilities.AssemblyDirectory +
                              @"\Routines\TuanHAPaladinSpecialEdition\Preset\TuanHA " + Classname.GetCurrentSpec() +
                              " Paladin Default AFK.xml");
                Logging.Write("Load TuanHA " + Classname.GetCurrentSpec() +
                              " Paladin Default AFK Settings from a file fail.");
                Logging.Write("----------------------------------");
                THForm_Load(null, null);
            }
        }

        #endregion

        #region SaveSettings

        private void SaveSettings_Click(object sender, EventArgs e)
        {
            var saveFileDialog = new SaveFileDialog();
            saveFileDialog.Filter = "Setting File|*.xml";
            saveFileDialog.Title = "Save Setting to a File";
            saveFileDialog.InitialDirectory = Utilities.AssemblyDirectory +
                                              @"\Routines\TuanHAPaladinSpecialEdition\User Settings\";
            saveFileDialog.DefaultExt = "xml";
            saveFileDialog.FileName = "TuanHA " + Classname.GetCurrentSpec() + " Paladin";

            saveFileDialog.ShowDialog();

            if (saveFileDialog.FileName.Contains(".xml"))
            {
                //Logging.Write(DialogResult.ToString());
                THSettings.Instance.SaveToFile(saveFileDialog.FileName);
                Logging.Write("----------------------------------");
                Logging.Write("Save Setting to: " + saveFileDialog.FileName);
                Logging.Write("----------------------------------");
            }
            else
            {
                return;
            }
        }

        #endregion

        #region LoadSettings

        private void LoadSettings_Click(object sender, EventArgs e)
        {
            var openFileDialog = new OpenFileDialog
                {
                    Filter = "Setting File|*.xml",
                    Title = "Load Setting from a File",
                    InitialDirectory =
                        Utilities.AssemblyDirectory + @"\Routines\TuanHAPaladinSpecialEdition\User Settings\"
                };
            openFileDialog.ShowDialog();

            if (openFileDialog.FileName.Contains(".xml"))
            {
                //Logging.Write(DialogResult.ToString());
                THSettings.Instance.LoadFromXML(XElement.Load(openFileDialog.FileName));
                Logging.Write("----------------------------------");
                Logging.Write("Load Setting from: " + openFileDialog.FileName);
                Logging.Write("----------------------------------");

                THForm_Load(null, null);
            }
            else
            {
                return;
            }
        }

        #endregion

        #endregion

        private void RepentanceCC_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.RepentanceCC = RepentanceCC.Checked;
        }

        private void Trinket1_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 10; i++)
            {
                if (Trinket1.SelectedIndex == i)
                {
                    THSettings.Instance.Trinket1 = i;
                }
            }
        }

        private void Trinket1HP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.Trinket1HP = (int) Trinket1HP.Value;
        }

        private void Trinket2_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 10; i++)
            {
                if (Trinket2.SelectedIndex == i)
                {
                    THSettings.Instance.Trinket2 = i;
                }
            }
        }

        private void Trinket2HP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.Trinket2HP = (int) Trinket2HP.Value;
        }

        private void ProfBuff_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 10; i++)
            {
                if (ProfBuff.SelectedIndex == i)
                {
                    THSettings.Instance.ProfBuff = i;
                }
            }
        }

        private void ProfBuffHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.ProfBuffHP = (int) ProfBuffHP.Value;
        }

        private void BurstKey_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 60; i++)
            {
                if (BurstKey.SelectedIndex == i)
                {
                    THSettings.Instance.BurstKey = i;
                }
            }
        }

        private void BurstHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.BurstHP = (int) BurstHP.Value;
        }

        private void AutoBuff_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AutoBuff = AutoBuff.Checked;
        }

        private void AutoFace_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AutoFace = AutoFace.Checked;
        }

        private void AutoMove_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AutoMove = AutoMove.Checked;
        }

        private void AutoRighteousFury_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AutoRighteousFury = AutoRighteousFury.Checked;
        }

        private void AutoRacial_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AutoRacial = AutoRacial.Checked;
        }

        private void AutoTaunt_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AutoTaunt = AutoTaunt.Checked;
        }

        private void AutoTarget_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AutoTarget = AutoTarget.Checked;
        }

        private void TurnEvilASAP_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.TurnEvilASAP = TurnEvilASAP.Checked;
        }

        private void PreferKings_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.PreferKings = PreferKings.Checked;
        }

        private void PreferMight_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.PreferMight = PreferMight.Checked;
        }

        private void AutoUseFoodHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AutoUseFoodHP = (int) AutoUseFoodHP.Value;
        }

        private void PauseKey_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 40; i++)
            {
                if (PauseKey.SelectedIndex == i)
                {
                    THSettings.Instance.PauseKey = i;
                }
            }
        }

        private void StrafleLeft_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 40; i++)
            {
                if (StrafleLeft.SelectedIndex == i)
                {
                    THSettings.Instance.StrafleLeft = i;
                }
            }
        }

        private void Forward_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 40; i++)
            {
                if (Forward.SelectedIndex == i)
                {
                    THSettings.Instance.Forward = i;
                }
            }
        }

        private void StrafleRight_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 40; i++)
            {
                if (StrafleRight.SelectedIndex == i)
                {
                    THSettings.Instance.StrafleRight = i;
                }
            }
        }

        private void TurnLeft_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 40; i++)
            {
                if (TurnLeft.SelectedIndex == i)
                {
                    THSettings.Instance.TurnLeft = i;
                }
            }
        }

        private void Backward_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 40; i++)
            {
                if (Backward.SelectedIndex == i)
                {
                    THSettings.Instance.Backward = i;
                }
            }
        }

        private void TurnRight_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 40; i++)
            {
                if (TurnRight.SelectedIndex == i)
                {
                    THSettings.Instance.TurnRight = i;
                }
            }
        }

        private void CleanseASAP_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.CleanseASAP = CleanseASAP.Checked;
        }

        private void CleanseDebuffNumber_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.CleanseDebuffNumber = (int) CleanseDebuffNumber.Value;
        }

        private void ManaforDPS_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.ManaforDPS = (int) ManaforDPS.Value;
        }

        private void CrusaderStrikeHoly_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.CrusaderStrikeHoly = CrusaderStrikeHoly.Checked;
        }

        private void Denounce_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.Denounce = Denounce.Checked;
        }

        private void HammerofWrathHoly_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HammerofWrathHoly = HammerofWrathHoly.Checked;
        }

        private void HolyShockOffensive_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HolyShockOffensive = HolyShockOffensive.Checked;
        }

        private void JudgmentHolyAttack_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.JudgmentHolyAttack = JudgmentHolyAttack.Checked;
        }

        private void BeaconofLight_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.BeaconofLight = BeaconofLight.Checked;
        }

        private void HolyRadianceNumber_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HolyRadianceNumber = (int) HolyRadianceNumber.Value;
        }

        private void HolyRadianceHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HolyRadianceHP = (int) HolyRadianceHP.Value;
        }

        private void LightofDawnNumber_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.LightofDawnNumber = (int) LightofDawnNumber.Value;
        }

        private void LightofDawnHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.LightofDawnHP = (int) LightofDawnHP.Value;
        }

        private void DivineFavorHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DivineFavorHP = (int) DivineFavorHP.Value;
        }

        private void DivineLightHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DivineLightHP = (int) DivineLightHP.Value;
        }

        private void GuardianofAncientKingsHolyHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.GuardianofAncientKingsHolyHP = (int) GuardianofAncientKingsHolyHP.Value;
        }

        private void HolyAvengerHolyHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HolyAvengerHolyHP = (int) HolyAvengerHolyHP.Value;
        }

        private void EternalFlameBlanketHolyPower_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.EternalFlameBlanketHolyPower = (int) EternalFlameBlanketHolyPower.Value;
        }

        private void FlashofLightHolyHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.FlashofLightHolyHP = (int) FlashofLightHolyHP.Value;
        }

        private void HolyLightHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HolyLightHP = (int) HolyLightHP.Value;
        }

        private void WordofGloryHolyHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.WordofGloryHolyHP = (int) WordofGloryHolyHP.Value;
        }

        private void OnlyHealMe_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.OnlyHealMe = OnlyHealMe.Checked;
        }

        private void OnlyHealTarget_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.OnlyHealTarget = OnlyHealTarget.Checked;
        }

        private void OnlyHealFocus_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.OnlyHealFocus = OnlyHealFocus.Checked;
        }

        private void Group1_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.Group1 = Group1.Checked;
        }

        private void Group2_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.Group2 = Group2.Checked;
        }

        private void Group3_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.Group3 = Group3.Checked;
        }

        private void Group4_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.Group4 = Group4.Checked;
        }

        private void Group5_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.Group5 = Group5.Checked;
        }

        private void Group6_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.Group6 = Group6.Checked;
        }

        private void Group7_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.Group7 = Group7.Checked;
        }

        private void Group8_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.Group8 = Group8.Checked;
        }

        private void ArdentDefenderHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.ArdentDefenderHP = (int) ArdentDefenderHP.Value;
        }

        private void GuardianofAncientKingsProtHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.GuardianofAncientKingsProtHP = (int) GuardianofAncientKingsProtHP.Value;
        }

        private void WordofGloryMeProtHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.WordofGloryMeProtHP = (int) WordofGloryMeProtHP.Value;
        }

        private void SacredShieldRet_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SacredShieldRet = SacredShieldRet.Checked;
        }

        private void DivineStormUnit_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DivineStormUnit = (int) DivineStormUnit.Value;
        }

        private void FlashofLightMeRetHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.FlashofLightMeRetHP = (int) FlashofLightMeRetHP.Value;
        }

        private void FlashofLightFriendRetHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.FlashofLightFriendRetHP = (int) FlashofLightFriendRetHP.Value;
        }

        private void HammeroftheRighteousUnitNumber_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HammeroftheRighteousRetNumber = (int) HammeroftheRighteousUnitNumber.Value;
        }

        private void InquisitionHolyPower_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.InquisitionHolyPower = (int) InquisitionHolyPowerNumber.Value;
        }

        private void WordofGloryMeRet_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.WordofGloryMeRetHP = (int) WordofGloryMeRetHP.Value;
        }

        private void WordofGloryFriendRet_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.WordofGloryFriendRetHP = (int) WordofGloryFriendRetHP.Value;
        }

        private void HealBalancing_Scroll(object sender, EventArgs e)
        {
            label66.Text = "" + HealBalancing.Value;
            THSettings.Instance.HealBalancing = (int) HealBalancing.Value;
        }

        private void AutoRez_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AutoRez = AutoRez.Checked;
        }

        private void Rebuke_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.Rebuke = Rebuke.Checked;
        }

        private void RebukeMs_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.RebukeMs = (int) RebukeMs.Value;
        }

        private void HammerofJusticeInterrupt_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HammerofJusticeInterrupt = HammerofJusticeInterrupt.Checked;
        }

        private void HammerofJusticeInterruptMs_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HammerofJusticeInterruptMs = (int) HammerofJusticeInterruptMs.Value;
        }

        private void InterruptAll_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.InterruptAll = InterruptAll.Checked;
        }

        private void InterruptTarget_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.InterruptTarget = InterruptTarget.Checked;
        }

        private void InterruptFocus_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.InterruptFocus = InterruptFocus.Checked;
        }

        private void BlindingLightInterrupt_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.BlindingLightInterrupt = BlindingLightInterrupt.Checked;
        }

        private void BlindingLightInterruptMs_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.BlindingLightInterruptMs = (int) BlindingLightInterruptMs.Value;
        }


        private void AutoUseFood_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AutoUseFood = AutoUseFood.Checked;
        }

        private void BlindingLightLow_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.BlindingLightLow = BlindingLightLow.Checked;
        }

        private void BlindingLightLowHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.BlindingLightLowHP = (int) BlindingLightLowHP.Value;
        }

        private void HammerofJusticeLow_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HammerofJusticeLow = HammerofJusticeLow.Checked;
        }

        private void HammerofJusticeLowHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HammerofJusticeLowHP = (int) HammerofJusticeLowHP.Value;
        }

        private void HammerofJusticeEnemyLow_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HammerofJusticeEnemyLow = HammerofJusticeEnemyLow.Checked;
        }

        private void HammerofJusticeEnemyLowHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HammerofJusticeEnemyLowHP = (int) HammerofJusticeEnemyLowHP.Value;
        }

        private void BattleStandard_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.BattleStandard = BattleStandard.Checked;
        }

        private void BattleStandardHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.BattleStandardHP = (int) BattleStandardHP.Value;
        }

        private void ExecutionSentenceFriend_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.ExecutionSentenceFriend = ExecutionSentenceFriend.Checked;
        }

        private void ExecutionSentenceFriendHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.ExecutionSentenceFriendHP = (int) ExecutionSentenceFriendHP.Value;
        }

        private void ExecutionSentenceEnemy_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.ExecutionSentenceEnemy = ExecutionSentenceEnemy.Checked;
        }

        private void ExecutionSentenceEnemyHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.ExecutionSentenceEnemyHP = (int) ExecutionSentenceEnemyHP.Value;
        }

        private void DevotionAura_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DevotionAura = DevotionAura.Checked;
        }

        private void DevotionAuraHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DevotionAuraHP = (int) DevotionAuraHP.Value;
        }

        private void DivinePlea_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DivinePlea = DivinePlea.Checked;
        }

        private void DivinePleaHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DivinePleaHP = (int) DivinePleaHP.Value;
        }

        private void DivineProtection_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DivineProtection = DivineProtection.Checked;
        }

        private void DivineProtectionHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DivineProtectionHP = (int) DivineProtectionHP.Value;
        }

        private void DivineShield_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DivineShield = DivineShield.Checked;
        }

        private void DivineShieldHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DivineShieldHP = (int) DivineShieldHP.Value;
        }

        private void HandofFreedomMyself_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HandofFreedomMyself = HandofFreedomMyself.Checked;
        }

        private void HandofFreedomMelee_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HandofFreedomMelee = HandofFreedomMelee.Checked;
        }

        private void HandofFreedomHealer_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HandofFreedomHealer = HandofFreedomHealer.Checked;
        }

        private void HandofFreedomCaster_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HandofFreedomCaster = HandofFreedomCaster.Checked;
        }

        private void HandofProtection_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HandofProtection = HandofProtection.Checked;
        }

        private void HandofProtectionHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HandofProtectionHP = (int) HandofProtectionHP.Value;
        }

        private void HandofProtectionHPRemoveCC_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HandofProtectionHPRemoveCC = HandofProtectionHPRemoveCC.Checked;
        }

        private void HandofPurity_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HandofPurity = HandofPurity.Checked;
        }

        private void HandofPurityHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HandofPurityHP = (int) HandofPurityHP.Value;
        }

        private void HandofPurityDebuff_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HandofPurityDebuff = HandofPurityDebuff.Checked;
        }

        private void HandofPurityDebuffNumber_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HandofPurityDebuffNumber = (int) HandofPurityDebuffNumber.Value;
        }

        private void HandofSacrifice_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HandofSacrifice = HandofSacrifice.Checked;
        }

        private void HandofSacrificeHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HandofSacrificeHP = (int) HandofSacrificeHP.Value;
        }

        private void HandofSacCCRemoveMelee_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HandofSacCCRemoveMelee = HandofSacCCRemoveMelee.Checked;
        }

        private void HandofSacCCRemoveHealer_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HandofSacCCRemoveHealer = HandofSacCCRemoveHealer.Checked;
        }

        private void HandofSacCCRemoveCaster_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HandofSacCCRemoveCaster = HandofSacCCRemoveCaster.Checked;
        }

        private void HealthStone_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HealthStone = HealthStone.Checked;
        }

        private void HealthStoneHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HealthStoneHP = (int) HealthStoneHP.Value;
        }

        private void HolyPrismFriend_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HolyPrismFriend = HolyPrismFriend.Checked;
        }

        private void HolyPrismFriendHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HolyPrismFriendHP = (int) HolyPrismFriendHP.Value;
        }

        private void HolyPrismEnemy_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HolyPrismEnemy = HolyPrismEnemy.Checked;
        }

        private void HolyPrismEnemyHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HolyPrismEnemyHP = (int) HolyPrismEnemyHP.Value;
        }

        private void HolyPrismEnemyHeal_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HolyPrismEnemyHeal = HolyPrismEnemyHeal.Checked;
        }

        private void HolyPrismEnemyHealNumber_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HolyPrismEnemyHealNumber = (int) HolyPrismEnemyHealNumber.Value;
        }

        private void HolyPrismEnemyHealHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HolyPrismEnemyHealHP = (int) HolyPrismEnemyHealHP.Value;
        }

        private void LayonHands_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.LayonHands = LayonHands.Checked;
        }

        private void LayonHandsHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.LayonHandsHP = (int) LayonHandsHP.Value;
        }

        private void LightsHammerEnemy_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.LightsHammerEnemy = LightsHammerEnemy.Checked;
        }

        private void LightsHammerEnemyNumber_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.LightsHammerEnemyNumber = (int) LightsHammerEnemyNumber.Value;
        }

        private void LightsHammerFriend_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.LightsHammerFriend = LightsHammerFriend.Checked;
        }

        private void LightsHammerFriendNumber_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.LightsHammerFriendNumber = (int) LightsHammerFriendNumber.Value;
        }

        private void LightsHammerFriendHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.LightsHammerFriendHP = (int) LightsHammerFriendHP.Value;
        }

        private void SelflessHealer_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SelflessHealer = SelflessHealer.Checked;
        }

        private void SelflessHealerHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SelflessHealerHP = (int) SelflessHealerHP.Value;
        }

        private void SpeedofLight_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SpeedofLight = SpeedofLight.Checked;
        }

        private void SpeedofLightDistance_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SpeedofLightDistance = (int) SpeedofLightDistance.Value;
        }

        private void CleanseDebuff_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.CleanseDebuff = CleanseDebuff.Checked;
        }

        private void HolyRadiance_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HolyRadiance = HolyRadiance.Checked;
        }

        private void LightofDawn_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.LightofDawn = LightofDawn.Checked;
        }

        private void AvengingWrathHoly_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AvengingWrathHoly = AvengingWrathHoly.Checked;
        }

        private void AvengingWrathHolyNumber_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AvengingWrathHolyNumber = (int) AvengingWrathHolyNumber.Value;
        }

        private void AvengingWrathHolyHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AvengingWrathHolyHP = (int) AvengingWrathHolyHP.Value;
        }

        private void DivineFavor_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DivineFavor = DivineFavor.Checked;
        }

        private void DivineFavorNumber_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DivineFavorNumber = (int) DivineFavorNumber.Value;
        }

        private void DivineLight_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DivineLight = DivineLight.Checked;
        }

        private void EternalFlameBlanket_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.EternalFlameBlanket = EternalFlameBlanket.Checked;
        }

        private void FlashofLightHoly_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.FlashofLightHoly = FlashofLightHoly.Checked;
        }

        private void GuardianofAncientKingsHoly_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.GuardianofAncientKingsHoly = GuardianofAncientKingsHoly.Checked;
        }

        private void GuardianofAncientKingsHolyNumber_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.GuardianofAncientKingsHolyNumber = (int) GuardianofAncientKingsHolyNumber.Value;
        }

        private void HolyAvengerHolyNumber_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HolyAvengerHolyNumber = (int) HolyAvengerHolyNumber.Value;
        }

        private void HolyAvengerHoly_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HolyAvengerHoly = HolyAvengerHoly.Checked;
        }

        private void HolyLight_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HolyLight = HolyLight.Checked;
        }

        private void WordofGloryHoly_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.WordofGloryHoly = WordofGloryHoly.Checked;
        }

        private void ArdentDefender_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.ArdentDefender = ArdentDefender.Checked;
        }

        private void FlashofLightMeProtHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.FlashofLightMeProtHP = (int) FlashofLightMeProtHP.Value;
        }

        private void FlashofLightMeProt_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.FlashofLightMeProt = FlashofLightMeProt.Checked;
        }

        private void GuardianofAncientKingsProt_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.GuardianofAncientKingsProt = GuardianofAncientKingsProt.Checked;
        }

        private void WordofGloryMeProt_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.WordofGloryMeProt = WordofGloryMeProt.Checked;
        }

        private void DivineStorm_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DivineStorm = DivineStorm.Checked;
        }

        private void FlashofLightMeRet_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.FlashofLightMeRet = FlashofLightMeRet.Checked;
        }

        private void FlashofLightFriendRet_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.FlashofLightFriendRet = FlashofLightFriendRet.Checked;
        }

        private void Inquisition_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.Inquisition = Inquisition.Checked;
        }

        private void HammeroftheRighteousUnit_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HammeroftheRighteousRet = HammeroftheRighteousUnit.Checked;
        }

        private void SealofRighteousnessRetNumber_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SealofRighteousnessRetNumber = (int) SealofRighteousnessRetNumber.Value;
        }

        private void SealofRighteousnessRet_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SealofRighteousnessRet = SealofRighteousnessRet.Checked;
        }

        private void WordofGloryMeRet_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.WordofGloryMeRet = WordofGloryMeRet.Checked;
        }

        private void WordofGloryFriendRet_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.WordofGloryFriendRet = WordofGloryFriendRet.Checked;
        }

        private void TurnEvil_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.TurnEvil = TurnEvil.Checked;
        }

        private void HammerofJusticeEnemyUsingCD_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HammerofJusticeEnemyUsingCD = HammerofJusticeEnemyUsingCD.Checked;
        }

        private void HolyPrismFriendDPS_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HolyPrismFriendDPS = HolyPrismFriendDPS.Checked;
        }

        private void HolyPrismFriendDPSNumber_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HolyPrismFriendDPSNumber = (int) HolyPrismFriendDPSNumber.Value;
        }

        private void DevotionAuraSilence_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DevotionAuraSilence = DevotionAuraSilence.Checked;
        }

        private void DevotionAuraSilenceAny_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DevotionAuraSilenceAny = DevotionAuraSilenceAny.Checked;
        }

        private void DevotionAuraSilenceHealer_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DevotionAuraSilenceHealer = DevotionAuraSilenceHealer.Checked;
        }

        private void DevotionAuraSilenceCaster_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DevotionAuraSilenceCaster = DevotionAuraSilenceCaster.Checked;
        }

        private void DevotionAuraSilenceHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.DevotionAuraSilenceHP = (int) DevotionAuraSilenceHP.Value;
        }

        private void HammeroftheRighteousProt_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HammeroftheRighteousProt = HammeroftheRighteousProt.Checked;
        }

        private void HammeroftheRighteousProtUnit_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HammeroftheRighteousProtUnit = (int) HammeroftheRighteousProtUnit.Value;
        }

        private void HammeroftheRighteousRetWeakenedBlows_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HammeroftheRighteousRetWeakenedBlows = HammeroftheRighteousRetWeakenedBlows.Checked;
        }

        private void SealofRighteousnessProt_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SealofRighteousnessProt = SealofRighteousnessProt.Checked;
        }

        private void SealofRighteousnessProtNumber_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SealofRighteousnessProtNumber = (int) SealofRighteousnessProtNumber.Value;
        }

        private void ShieldofRighterous_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.ShieldofRighterous = ShieldofRighterous.Checked;
        }

        private void ShieldofRighterousHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.ShieldofRighterousHP = (int) ShieldofRighterousHP.Value;
        }

        private void SacredShieldProt_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.SacredShieldProt = SacredShieldProt.Checked;
        }

        private void AvengersShieldLoseThreat_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AvengersShieldLowestThreat = AvengersShieldLoseThreat.Checked;
        }

        private void HandofSalvHighThreat_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HandofSalvHighThreat = HandofSalvHighThreat.Checked;
        }

        private void HandofSalvHighThreatPercent_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.HandofSalvHighThreatPercent = (int) HandofSalvHighThreatPercent.Value;
        }

        private void JudgmentLongArmoftheLaw_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.JudgmentLongArmoftheLaw = JudgmentLongArmoftheLaw.Checked;
        }

        private void JudgmentBurdenofGuilt_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.JudgmentBurdenofGuilt = JudgmentBurdenofGuilt.Checked;
        }

        //Hotkey1
        private void Hotkey1Target_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 3; i++)
            {
                if (Hotkey1Target.SelectedIndex == i)
                {
                    THSettings.Instance.Hotkey1Target = i;
                }
            }
        }

        private void Hotkey1Mod_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 2; i++)
            {
                if (Hotkey1Mod.SelectedIndex == i)
                {
                    THSettings.Instance.Hotkey1Mod = i;
                }
            }
        }

        private void Hotkey1Key_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 40; i++)
            {
                if (Hotkey1Key.SelectedIndex == i)
                {
                    THSettings.Instance.Hotkey1Key = i;
                }
            }
        }

        private void Hotkey1Spell_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 40; i++)
            {
                if (Hotkey1Spell.SelectedIndex == i)
                {
                    THSettings.Instance.Hotkey1Spell = i;
                }
            }
        }

        //Hotkey2
        private void Hotkey2Target_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 3; i++)
            {
                if (Hotkey2Target.SelectedIndex == i)
                {
                    THSettings.Instance.Hotkey2Target = i;
                }
            }
        }

        private void Hotkey2Mod_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 2; i++)
            {
                if (Hotkey2Mod.SelectedIndex == i)
                {
                    THSettings.Instance.Hotkey2Mod = i;
                }
            }
        }

        private void Hotkey2Key_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 40; i++)
            {
                if (Hotkey2Key.SelectedIndex == i)
                {
                    THSettings.Instance.Hotkey2Key = i;
                }
            }
        }

        private void Hotkey2Spell_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 40; i++)
            {
                if (Hotkey2Spell.SelectedIndex == i)
                {
                    THSettings.Instance.Hotkey2Spell = i;
                }
            }
        }

        //Hotkey3
        private void Hotkey3Target_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 3; i++)
            {
                if (Hotkey3Target.SelectedIndex == i)
                {
                    THSettings.Instance.Hotkey3Target = i;
                }
            }
        }

        private void Hotkey3Mod_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 2; i++)
            {
                if (Hotkey3Mod.SelectedIndex == i)
                {
                    THSettings.Instance.Hotkey3Mod = i;
                }
            }
        }

        private void Hotkey3Key_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 40; i++)
            {
                if (Hotkey3Key.SelectedIndex == i)
                {
                    THSettings.Instance.Hotkey3Key = i;
                }
            }
        }

        private void Hotkey3Spell_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 40; i++)
            {
                if (Hotkey3Spell.SelectedIndex == i)
                {
                    THSettings.Instance.Hotkey3Spell = i;
                }
            }
        }

        //Hotkey4
        private void Hotkey4Target_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 3; i++)
            {
                if (Hotkey4Target.SelectedIndex == i)
                {
                    THSettings.Instance.Hotkey4Target = i;
                }
            }
        }

        private void Hotkey4Mod_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 2; i++)
            {
                if (Hotkey4Mod.SelectedIndex == i)
                {
                    THSettings.Instance.Hotkey4Mod = i;
                }
            }
        }

        private void Hotkey4Key_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 40; i++)
            {
                if (Hotkey4Key.SelectedIndex == i)
                {
                    THSettings.Instance.Hotkey4Key = i;
                }
            }
        }

        private void Hotkey4Spell_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 40; i++)
            {
                if (Hotkey4Spell.SelectedIndex == i)
                {
                    THSettings.Instance.Hotkey4Spell = i;
                }
            }
        }

        //Hotkey5
        private void Hotkey5Target_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 3; i++)
            {
                if (Hotkey5Target.SelectedIndex == i)
                {
                    THSettings.Instance.Hotkey5Target = i;
                }
            }
        }

        private void Hotkey5Mod_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 2; i++)
            {
                if (Hotkey5Mod.SelectedIndex == i)
                {
                    THSettings.Instance.Hotkey5Mod = i;
                }
            }
        }

        private void Hotkey5Key_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 40; i++)
            {
                if (Hotkey5Key.SelectedIndex == i)
                {
                    THSettings.Instance.Hotkey5Key = i;
                }
            }
        }

        private void Hotkey5Spell_SelectedIndexChanged(object sender, EventArgs e)
        {
            for (var i = 0; i <= 40; i++)
            {
                if (Hotkey5Spell.SelectedIndex == i)
                {
                    THSettings.Instance.Hotkey5Spell = i;
                }
            }
        }

        private void BurstDelay_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.BurstDelay = (int) BurstDelay.Value;
        }

        private void Consecration_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.Consecration = Consecration.Checked;
        }

        private void WordofGloryMeProtHolyPower_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.WordofGloryMeProtHolyPower = (int) WordofGloryMeProtHolyPower.Value;
        }

        private void WordofGloryFriendProt_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.WordofGloryFriendProt = WordofGloryFriendProt.Checked;
        }

        private void WordofGloryFriendProtHolyPower_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.WordofGloryFriendProtHolyPower = (int) WordofGloryFriendProtHolyPower.Value;
        }

        private void WordofGloryFriendProtHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.WordofGloryFriendProtHP = (int) WordofGloryFriendProtHP.Value;
        }

        private void AutoCancelBubble_CheckedChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AutoCancelBubble = AutoCancelBubble.Checked;
        }

        private void AutoCancelBubbleHP_ValueChanged(object sender, EventArgs e)
        {
            THSettings.Instance.AutoCancelBubbleHP = (int) AutoCancelBubbleHP.Value;
        }

    }
}